home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWGDIObj.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.8 KB  |  190 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGDIObj.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. #ifdef FW_BUILD_WIN
  10.  
  11. #ifndef FWGDIOBJ_H
  12. #define FWGDIOBJ_H
  13.  
  14. #ifndef FWGRDEF_H
  15. #include "FWGrDef.h"
  16. #endif
  17.  
  18. #ifndef FWGCONST_H
  19. #include "FWGConst.h"
  20. #endif
  21.  
  22. #ifndef FWPAT_H
  23. #include "FWPat.h"
  24. #endif
  25.  
  26. // ----- Foundation Layer -----
  27.  
  28. #ifndef    FWAUTODE_H
  29. #include <FWAutoDe.h>
  30. #endif
  31.  
  32. //========================================================================================
  33. //    Forward Class Declarations
  34. //========================================================================================
  35.  
  36. #define FW_kNotStockObject -1
  37.  
  38. //========================================================================================
  39. //    Forward Class Declarations
  40. //========================================================================================
  41.  
  42. //========================================================================================
  43. //    class FW_SGDIObject
  44. //========================================================================================
  45.  
  46. struct FW_CLASS_ATTR FW_SGDIObject
  47. {
  48.     FW_SGDIObject()
  49.         { fObject = NULL; fIsStock = FALSE; }
  50.     FW_SGDIObject(HGDIOBJ hObject, FW_Boolean isStock)
  51.         { fObject = hObject; fIsStock = isStock; }
  52.  
  53.     FW_Boolean operator==(const FW_SGDIObject& other) const
  54.         { return fObject == other.fObject;}
  55.     FW_Boolean operator!=(const FW_SGDIObject& other) const
  56.         { return fObject != other.fObject;}
  57.  
  58.     FW_Boolean operator==(HGDIOBJ GDIObject) const
  59.         { return fObject == GDIObject; }
  60.     FW_Boolean operator!=(HGDIOBJ GDIObject) const
  61.         { return fObject != GDIObject ;}
  62.  
  63.     operator HGDIOBJ() const
  64.         { return fObject; }
  65.                 
  66.     HGDIOBJ     fObject;
  67.     FW_Boolean     fIsStock;
  68.     
  69. private:
  70.     FW_SGDIObject(const FW_SGDIObject& other);
  71.     FW_SGDIObject& operator=(const FW_SGDIObject& other);
  72. };
  73.  
  74. //========================================================================================
  75. //    class FW_CPrivGDIObject
  76. //========================================================================================
  77.  
  78. class FW_CLASS_ATTR FW_CPrivGDIObject FW_AUTO_DESTRUCT_OBJECT
  79. {
  80. public:
  81.     FW_CPrivGDIObject();
  82.     virtual ~FW_CPrivGDIObject();
  83.     
  84.     void                SetStockID(int stockID);
  85.     
  86.     void                UnselectObject(HDC hdc);
  87.     void                SelectObject(HDC hdc);
  88.     
  89.     HGDIOBJ                GetObject(HDC hdc);
  90.     
  91.     virtual HGDIOBJ        CreateObject() = 0;
  92.  
  93. private:    
  94.     void                MakeGDIObject(FW_SGDIObject& GDIObject);
  95.     void                DeleteGDIObject(FW_SGDIObject& GDIObject);
  96.     
  97. protected:    
  98.     FW_SGDIObject        fGDIObject;
  99.     
  100.     FW_Boolean            fChanged;
  101.     
  102.     int                    fStockID;
  103.     FW_Boolean            fStockObject;
  104.     
  105.     HDC                    fDC;
  106.     HGDIOBJ                fPreviousObject;
  107. };
  108.  
  109. //========================================================================================
  110. //    class FW_CPrivGDIPen
  111. //========================================================================================
  112.  
  113. class FW_CLASS_ATTR FW_CPrivGDIPen : public FW_CPrivGDIObject
  114. {
  115. public:
  116.     FW_CPrivGDIPen();
  117.     virtual ~FW_CPrivGDIPen();
  118.  
  119.     void                SetPenSize(int width);
  120.     void                SetPenStyle(FW_EStyleDash dashStyle);
  121.     void                SetPenColor(COLORREF color);
  122.  
  123.     virtual HGDIOBJ        CreateObject();
  124.     
  125.     int                    GetPenSize();
  126.  
  127. private:    
  128.     int                    fWidth;
  129.     FW_EStyleDash        fDashStyle;
  130.     COLORREF            fColor;
  131. };
  132.  
  133. //----------------------------------------------------------------------------------------
  134. //    FW_CPrivGDIBrush::GetPenSize
  135. //----------------------------------------------------------------------------------------
  136.  
  137. inline int FW_CPrivGDIPen::GetPenSize()
  138. {
  139.     return fWidth;
  140. }
  141.  
  142. //========================================================================================
  143. //    class FW_CPrivGDIBrush
  144. //========================================================================================
  145.  
  146. class FW_CLASS_ATTR FW_CPrivGDIBrush : public FW_CPrivGDIObject
  147. {
  148. public:
  149.     FW_CPrivGDIBrush();
  150.     virtual ~FW_CPrivGDIBrush();
  151.  
  152.     void                SetBrushPattern(const FW_PPattern& pattern);
  153.     void                SetBrushColor(COLORREF color);
  154.  
  155.     virtual HGDIOBJ        CreateObject();
  156.  
  157.     HBRUSH                GetBrush(HDC hdc);
  158.  
  159. private:    
  160.     FW_Boolean            fSolidColorBrush;
  161.     COLORREF            fColor;
  162.     FW_PPattern            fPattern;
  163. };
  164.  
  165. //========================================================================================
  166. //    class FW_CPrivGDIFont
  167. //========================================================================================
  168.  
  169. class FW_CLASS_ATTR FW_CPrivGDIFont : public FW_CPrivGDIObject
  170. {
  171. public:
  172.     FW_CPrivGDIFont();
  173.     virtual ~FW_CPrivGDIFont();
  174.  
  175.     void                SetFontName(const char* fontName);
  176.     void                SetFontStyle(FW_FontStyle fontStyle);
  177.     void                SetFontSize(short fontSize);
  178.  
  179.     virtual HGDIOBJ    CreateObject();
  180.     
  181. private:
  182.     char                fFontName[LF_FACESIZE];
  183.     FW_FontStyle        fFontStyle;
  184.     short                fFontSize;
  185. };
  186.  
  187. #endif
  188.  
  189. #endif
  190.